/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package classes;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

/**
 *
 * @author Achie
 */
public class HibernateUtil {

    private static SessionFactory sessionFactory;

    static {
        sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
    }

    public HibernateUtil() {
    }

    public static Session openSession() {
        return sessionFactory.openSession();
    }

    public static void close() {
        sessionFactory.close();
    }
    
    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}

